package com.eqxiu.ieditor.api.controller.order.doc;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;

import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;

import com.eqxiu.ieditor.commons.web.ResultData;
import com.eqxiu.ieditor.dto.OrderDTO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

@Api(
		description = "业务订单接口"
)
public interface OrderApiDoc {

	@ApiOperation(
			value = "创建初始订单,订单状态未支付,支持消耗订单和充值订单", response = ResultData.class, httpMethod = "POST"
	)
	public ResultData createOrder(@ApiParam OrderDTO orderDTO, HttpServletRequest req)
			throws JsonGenerationException, JsonMappingException, IOException;

	@ApiOperation(
			value = "创建任意消耗订单,订单状态未支付", response = ResultData.class, httpMethod = "POST"
	)
	public ResultData createOrder2(@ApiParam OrderDTO orderDTO, HttpServletRequest req)
			throws JsonGenerationException, JsonMappingException, IOException;

	@ApiOperation(
			value = "查询订单信息,一般用于订单状态查询"
	)
	public ResultData queryOrder(@ApiParam(required = true, name = "orderId", value = "订单ID")Long orderId) throws Exception;

	@ApiOperation(
			value = "使用样例模板,如果存在订单,直接创景一个场景,如果不存在告诉调用方进行购买, source用来标示不同端，4=wap， 6=摇一摇等"
	)
	public ResultData useProduct(@ApiParam(
			required = true, name = "code", value = "模板 code"
	) String code, Integer source);

	@ApiOperation(
			value = "查询商品是否有购买某项功能,例如数据实时查看,数据实时推送"
	)
	@ApiImplicitParams(
		{ @ApiImplicitParam(
				required = true, name = "code", value = "模板 code", dataType = "string", paramType = "query"
		), @ApiImplicitParam(
				required = true, name = "itemType", value = "类型,1代表数据查看,2代表数据实时推送", dataType = "integer", paramType = "query"
		) }
	)
	public ResultData hasOrder(@ApiParam()String code, Integer itemType);

}
